//
//  SK_Trigger.swift
//  mng
//
//  Created by WTFKL on 2018/3/31.
//  Copyright © 2018年 WTF. All rights reserved.
//

import UIKit
import SpriteKit

class SK_Trigger: SKSpriteNode {
    /**
     -参数介绍
     mname = 标识
     mSize = 尺寸
     mColor = 颜色
     mPosition = 大小
     mCollisionBitMask 可以与之碰撞的物体的掩码相同则穿过
     mContactTestBitMask 可以与之碰撞的物体的掩码（触发事件）
     */
    
    convenience init( mName:String,mSize:CGSize,mColor:UIColor,mPosition:CGPoint,mCollisonBitMask:UInt32,mContactTestBitMask:UInt32) {
        self.init();
        self.name = mName;
        self.size = mSize;
        self.color = mColor;
        self.position = mPosition;
        self.physicsBody =  SKPhysicsBody(rectangleOf: mSize);
        self.physicsBody?.collisionBitMask = mCollisonBitMask;
        self.physicsBody?.categoryBitMask = BitMaskType.other;
        self.physicsBody?.contactTestBitMask = mContactTestBitMask;
        self.physicsBody?.isDynamic = false;
    }
}
